package com.shrcl.engineerprocess.domain.impl;

import com.shrcl.engineerprocess.domain.ActorsDAO;
import com.shrct.businessprocess.organization.RCEmployee;
import com.shrct.businessprocess.organization.RCEnterprise;
import edu.fudan.langlab.domain.organization.Party;
import edu.fudan.langlab.domain.security.User;
import edu.fudan.langlab.domain.task.TSKTaskOwner;
import edu.fudan.langlab.domain.task.TSKUserOwnerDAO;
import edu.fudan.mylang.pf.BaseDAOService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service("com.shrcl.engineerprocess.domain.ActorsDAO")
public class ActorsDAOImpl extends BaseDAOService<RCEmployee> implements ActorsDAO {
  @Autowired
  private TSKUserOwnerDAO taskdao;
  
  public TSKTaskOwner asTSKTaskOwner(final Party party) {
    TSKTaskOwner _switchResult = null;
    boolean _matched = false;
    if (!_matched) {
      if (party instanceof RCEmployee) {
        final RCEmployee _rCEmployee = (RCEmployee)party;
        _matched=true;
        User _asUser = _rCEmployee.asUser();
        TSKTaskOwner _asTSKOwner = this.taskdao.asTSKOwner(_asUser);
        _switchResult = _asTSKOwner;
      }
    }
    if (!_matched) {
      if (party instanceof RCEnterprise) {
        final RCEnterprise _rCEnterprise = (RCEnterprise)party;
        _matched=true;
        _switchResult = null;
      }
    }
    return _switchResult;
  }
}
